@extends('main')

@section('tip', '创建帖子')

@section('stylesheet')
    {!! Html::style('custom/css/parsley.css') !!}
    {!! Html::style('custom/css/select2.min.css') !!}
@endsection

@section('content')
<div class="row">
    <div class="col-md-10 col-md-offset-1">
        <h1>新博文</h1>
        <hr>
        {!! Form::open(['route'=>'post.store', 'data-parsley-validate'=>'']) !!}
        {!! Form::label('title', '标题:', ['style'=>'margin-top:20px']) !!}
        {!! Form::text('title', null, ['class'=>'form-control', 'required'=>'', 'maxlength'=>255]) !!}

        {!! Form::label('slug', 'Slug:', ['style'=>'margin-top:10px']) !!}
        {!! Form::text('slug', null, ['class'=>'form-control', 'required'=>'', 'minlength'=>5, 'maxlength'=>255]) !!}

        {!! Form::label('category_id', '所属分类:', ['style'=>'margin-top:10px']) !!}
        {!! Form::select('category_id', $categories, null, ['class'=>'form-control', 'required'=>'']) !!}

        {!! Form::label('tag', '添加标签:', ['style'=>'margin-top:10px']) !!}
        {!! Form::select('tag[]', $tags, null, ['class'=>'form-control js-example-basic-multiple', 'multiple'=>'multiple']) !!}

        {!! Form::label('body', '内容:', ['style'=>'margin-top:10px']) !!}
        {!! Form::textarea('body', null, ['class' => 'form-control', 'id'=>'tinymceform']) !!}

        {!! Form::submit('发表文章', ['class' => 'btn btn-success btn-block btn-lg', 'style'=>'margin:20px 0']) !!}
        {!! Form::close() !!}
    </div>
</div>

@endsection

@section('javascript')
    {!! Html::script('/custom/js/parsley.min.js') !!}
    {!! Html::script('/custom/js/i18n/zh-cn.js') !!}

    {{-- 国际化文件不一样 --}}
    {!! Html::script('/custom/js/select2.min.js') !!}
    {!! Html::script('/custom/js/i18n/zh-CN.js') !!}

    {!! Html::script('/custom/js/tinymce/tinymce.min.js') !!}
    <script type="text/javascript">
        $('.js-example-basic-multiple').select2();
        tinymce.init({
            selector:'#tinymceform',
            plugins:'code link preview',
            language:'zh_CN'
        });
    </script>
@endsection
